home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Perl Multimedia Cyber Classroom
/
PERL Multimedia Cyber Classroom (Prentice Hall)(1998).ISO
/
perlbyex
/
code.jar
/
07ex005.jar
/
code
/
ch07
/
07ex005
/
07ex005.pl
next >
Wrap
Perl Script
|
1998-04-01
|
1KB
|
34 lines
#!/export/perl/bin/perl
# I cut and pasted the usage message from the getopts.pl library function
# so that I could figure out what to do with it
# ------------------------------------------------------------------------
# Usage:
# do Getopts(\qa:bc\q); # -a takes arg. -b & -c not. Sets opt_* as a
# # side effect.
#
# ------------------------------------------------------------------------
push(@INC, "C:\perl\lib;." );
require "getopts.pl"
&Getopts("a:bc");
# Allowable command line arguments are:
# -a, -b, and -c.
# -a requires an argument that does not start with
# a dash, such as a filename or username.
# Any argument without a leading dash is ignored.
# An error is sent for any illegal argument (in this example, -d and -x are
# illegal).
# $opt_c gets set to 1 if the argument is -c.
# $opt_b gets set to 1 if the argument is -b.
# $opt_a gets set to the name of the argument if the argument is provided.
# If an argument is not provided for -a, $opt_a is not set.
# This program is called " prog " .
if ( $opt_a) { print " The option -a returns $opt_a
" ;}
if ( $opt_b) { print " The option -b returns $opt_b
" ; }
if ( $opt_c) { print " The option -c returns $opt_c
" ; }